<template>
  <el-dialog title="添加设备进行绑定" :visible.sync="addDeviceShow" width="60%" :before-close="beforeClose" append-to-body>
    <basicInfo :addDeviceShow='addDeviceShow' :deviceIDData="deviceIDData" @add-deviceData='addDeviceData' />
    <span slot="footer" class="dialog-footer">
      <el-button @click="beforeClose">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import basicInfo from '@/views/tpm/deviceAccount/basicInfo'
export default {
  name: 'addDevice',
  components: { basicInfo },
  props: {
    addDeviceShow: {
      type: Boolean,
      default: false,
    },
    deviceIDData: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {
      // addDevice: false,
      deviceData: [],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // 关闭
    beforeClose() {
      this.deviceData = []
      this.$parent.addDeviceShow = false
    },
    // 添加的设备
    addDeviceData(val) {
      this.deviceData = val
    },
    submit() {
      this.$emit('addDevices', this.deviceData)
    },
  },
}
</script>

<style lang="scss" scoped>
::v-deep .el-dialog__body {
  padding: 10px 20px 0;
  color: #606266;
  font-size: 14px;
  word-break: break-all;
}
</style>